import java.util.Scanner;

public class NumOf1 {
    public static void main(String[] args) {
        //求一个数二进制存储时 1 的个数
        int n = 0;
        int count = 0;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        n = scanner.nextInt();
        while(n != 0){
            n = n & (n - 1);
            count++;
        }
        System.out.println(count);
    }
}
